package server;

/*
* Http协议工具类，主要提供响应头信息，暂时只提供200和404情况
* */
public class HttpProtocolUtil {
    public static String getHttpHeader200(long length) {
        return "HTTP/1.1 200 OK \n" +
                "Content-Type: text/html \n" +
                "Content-Length: " + length + "\n" +
                "\r\n";
    }

    public static String getHttpHeader404() {
        String str404 = "<h1>404 Not Fond</h1>";
        return "HTTP/1.1 404 NOT FOUND \n" +
                "Content-Type: text/html \n" +
                "Content-Length: " + str404.getBytes().length + " \n" +
                "\r\n" + str404;
    }
}
